// pages/my/my.js
import myBehavior from "./behavior"
import {modal} from "../../utils/extendApi"
Page({

  behaviors: [myBehavior],

  /**
   * 页面的初始数据
   */
  data: {
    initpanel: [
      // {
      //   url: '*',
      //   title: '我的收藏',
      //   iconfont: 'icon-shoucang'
      // },
      {
        url: '/pages/userCommit/userCommit',
        title: '我的评价',
        iconfont: 'icon-pinglun'
      },
      {
        url: '/pages/address/address',
        title: '收货地址',
        iconfont: 'icon-dizhi'
      }
    ]
  },

    toLoginPage() {
      wx.navigateTo({
        url: '/pages/login/login',
      })
    },

    toUserInfo() {
      wx.navigateTo({
        url: '/pages/userInfo/userInfo',
      })
    },
    // 退出登录
    async unLogin() {
      const flag = await modal({content: '是否登出账户？'})
      // 确认登出
      if (flag) {
        // 清空存储数据
        wx.clearStorageSync()
        // 清空用户仓库数据
        this.setUserInfo({})
        this.setToken('')
      }
    }
})